﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Workflow2211A.Domain.Entities
{
    /// <summary>
    /// 流程设计表
    /// </summary>
    [Table("WorkflowDefinition")]
    public class WorkflowDefinitionModel:BaseEntity
    {
        /// <summary>
        /// 流程标识
        /// </summary>
        [MaxLength(100), Required]
        public string DefinitionId { get; set; } = string.Empty;
        /// <summary>
        /// 流程设计的标题
        /// </summary>
        [MaxLength(100), Required]
        public string Title { get; set; } = string.Empty;
        /// <summary>
        /// 流程的版本号
        /// </summary>
        public int Version { get; set; }
        /// <summary>
        /// 此流程的审批步骤 
        /// </summary>
        [Column(TypeName = "JSON"), Required]
        public string Steps { get; set; } = null!;
        /// <summary>
        /// 表单模版
        /// </summary>
        [Column(TypeName ="JSON")]
        public string? FormTemplate { get; set; } = null!;
    }
    //不直接映射数据库，作为 JSON 序列化的对象模型
    public class StepNode
    {

        /// <summary>
        /// 步骤ID
        /// </summary>
        public string StepId { get; set; }
        /// <summary>
        /// 步骤名称
        /// </summary>
        public string StepName { get; set; }
        /// <summary>
        /// 当前步骤审批人
        /// </summary>
        public string AuditName { get; set; }
        /// <summary>
        /// 审批人ID
        /// </summary>
        public long AuditUserId { get; set; }
        /// <summary>
        /// 下一个步骤
        /// </summary>
        public string NextStepId { get; set; }

    }    
}
